import { preFixPath } from '@/util'
export default {
    name: 'imgLink',
    functional: true,
    props: {
        imgurl: String,
        width: {
            type: Number,
            default: 200
        }
    },
    render: (h, ctx) => {
        function onImageClick (url) {
            ctx.parent.$vueImgPreview({
                url
            })
        }
        let url = ctx.props.imgurl || ''
        let w = `?x-oss-process=image/resize,w_${ctx.props.width}`
        let r = url.indexOf('http') > -1 ? url : preFixPath + url
        return <img onClick={() => onImageClick(r)} src={r+w} alt='图片'/>
    }
};